package pub_mgr

import (
	"math/rand"
	"venus/conf"
	"venus/util/zslice"
)

// RandomName 随机名字
func RandomName() string {
	gender := rand.Intn(2)
	return RandomNameGender(gender)
}

// RandomNameGender 随机名字 带性别 性别 0=男性 1=女性
func RandomNameGender(gender int) string {
	name := ""
	if len(conf.ListNameSur) > 0 {
		name = conf.ListNameSur[rand.Intn(len(conf.ListNameSur))]
	}
	if gender == 0 {
		if len(conf.ListNameMale) > 0 {
			name += conf.ListNameMale[rand.Intn(len(conf.ListNameMale))]
		}
	} else {
		if len(conf.ListNameFemale) > 0 {
			name += conf.ListNameFemale[rand.Intn(len(conf.ListNameFemale))]
		}
	}
	if name == "" {
		name = "无名氏"
	}
	return name
}

func CheckNameBad(name string) bool {
	return zslice.Contains(conf.ListNameBad, name)
}
